<?php

namespace app\controller;

use app\BaseController;
use think\facade\Cache;

class Index extends BaseController
{
    public function index()
    {
        Cache::tag('study')->set('name1','qsx1',10);
        Cache::tag('study')->set('name2','qsx2',10);
        Cache::tag('study')->set('name3','qsx3',10);
        Cache::tag('study')->set('name4','qsx4',10);
        Cache::tag('study_01')->set('name5','qsx5',10);
        $name1 = Cache::get('name1');
        $name2 = Cache::get('name2');
        $name3 = Cache::get('name3');
        $name4 = Cache::get('name4');
        $name5 = Cache::get('name5');
        print_r([$name1,$name2,$name3,$name4,$name5]);
        //清除 tag = study 的所有缓存
        Cache::tag('study')->clear();

        $name1 = Cache::get('name1');
        $name2 = Cache::get('name2');
        $name3 = Cache::get('name3');
        $name4 = Cache::get('name4');
        $name5 = Cache::get('name5');
        print_r([$name1,$name2,$name3,$name4,$name5]);die;
    }

    public function hello($name = 'ThinkPHP6')
    {
        return 'hello,' . $name;
    }
}
